/*
*  Logger.cpp
*  Parser
*
*  Created by Christoph Ehscheidt on 10.02.08.
*  Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/

#include "Logger.h"

FileOutput* FileOutput::instanz = 0;

FileOutput* FileOutput::getInstance() {
	static Secure w;
	if( instanz == 0 )
		instanz = new FileOutput();
	return instanz;
}

void FileOutput::writeLine(const char* line) {
	file << line << endl;
}

void FileOutput::setFile(const char* filename) {
	// Wenn bereits eine Datei ge�ffnet, diese schlie�en
	if (file.is_open()) file.close();
	// Datei �ffnen
	file.open (filename, ios::out | ios::ate);
}

void FileOutput::setFileOverWrite(const char* filename) {
	file.close();
	file.open (filename, ios::out);
}

void FileOutput::writeToken(Token* tok) {
	file << *tok << endl;
}


FileOutput::FileOutput() {
	//file.open ("output.log", ios::out | ios::ate);
}

FileOutput::~FileOutput() {
	file.close();
}
